package com.cloud.code.牛客网;

/**
 * 26. 删除有序数组中的重复项
 */
public class Test22 {

    public static void main(String[] args) {
        int [] nums = {1,1,2};
        removeDuplicates(nums);
    }

    public static int removeDuplicates(int[] nums) {

        int fast = 1;
        int slow = 1;

        for (int i = 0; i < nums.length && fast < nums.length; i++) {
            if(!(nums[fast] == nums[fast-1])){
                nums[slow] = nums[fast];
                slow ++;

            }
            fast ++;
        }

        return slow;
    }
}
